// 弹窗配置类型
export interface FormField {
  prop: string
  label: string
  placeholder: string
  required?: boolean
  minLength?: number
  maxLength?: number
  pattern?: RegExp
  patternMessage?: string
  type?: "input" | "select" // 字段类型
  options?: Array<{ label: string, value: string }> // 选择框选项
}

export interface DialogConfig {
  title: string
  description: string
  fields: FormField[]
  successMessage: string
  confirmButtonText?: string // 确认按钮文字，默认为"创建"
}

// 渠道服务商创建配置
export const channelDialogConfig: DialogConfig = {
  title: "创建渠道服务商",
  description: "填写渠道服务商的基本信息来创建新的合作伙伴。",
  fields: [
    {
      prop: "channelName",
      label: "渠道名称",
      placeholder: "请输入渠道名称，如：华东区域服务商",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 50
    },
    {
      prop: "contactPerson",
      label: "联系人",
      placeholder: "请输入联系人姓名，如：李经理",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 20
    },
    {
      prop: "contactPhone",
      label: "联系电话",
      placeholder: "请输入联系电话，如：13800138001",
      type: "input",
      required: true,
      pattern: /^1[3-9]\d{9}$/,
      patternMessage: "请输入正确的手机号码"
    }
  ],
  successMessage: "渠道服务商创建成功"
}

// 渠道服务商编辑配置
export const editChannelDialogConfig: DialogConfig = {
  title: "编辑渠道服务商",
  description: "修改渠道服务商的基本信息。",
  confirmButtonText: "更新",
  fields: [
    {
      prop: "name",
      label: "服务商名称",
      placeholder: "请输入服务商名称",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 50
    },
    {
      prop: "manager",
      label: "负责人",
      placeholder: "请输入负责人姓名",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 20
    },
    {
      prop: "phone",
      label: "联系电话",
      placeholder: "请输入联系电话",
      type: "input",
      required: true,
      pattern: /^1[3-9]\d{9}$/,
      patternMessage: "请输入正确的手机号码"
    },
    {
      prop: "status",
      label: "状态",
      placeholder: "请选择状态",
      type: "select",
      required: true,
      options: [
        { label: "合作中", value: "active" },
        { label: "暂停合作", value: "inactive" }
      ]
    }
  ],
  successMessage: "渠道服务商更新成功"
}

// 二级代理创建配置
export const secondAgentDialogConfig: DialogConfig = {
  title: "新增二级代理",
  description: "填写二级代理的基本信息。",
  fields: [
    {
      prop: "name",
      label: "代理名称",
      placeholder: "请输入代理名称",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 50
    },
    {
      prop: "manager",
      label: "负责人",
      placeholder: "请输入负责人姓名",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 20
    },
    {
      prop: "phone",
      label: "联系电话",
      placeholder: "请输入联系电话",
      type: "input",
      required: true,
      pattern: /^1[3-9]\d{9}$/,
      patternMessage: "请输入正确的手机号码"
    }
  ],
  successMessage: "二级代理创建成功"
}

// 三级代理创建配置
export const thirdAgentDialogConfig: DialogConfig = {
  title: "新增三级代理",
  description: "填写三级代理的基本信息。",
  fields: [
    {
      prop: "name",
      label: "代理名称",
      placeholder: "请输入代理名称",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 50
    },
    {
      prop: "manager",
      label: "负责人",
      placeholder: "请输入负责人姓名",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 20
    },
    {
      prop: "phone",
      label: "联系电话",
      placeholder: "请输入联系电话",
      type: "input",
      required: true,
      pattern: /^1[3-9]\d{9}$/,
      patternMessage: "请输入正确的手机号码"
    }
  ],
  successMessage: "三级代理创建成功"
}

// 二级代理编辑配置
export const editSecondAgentDialogConfig: DialogConfig = {
  title: "编辑二级代理",
  description: "修改二级代理的基本信息。",
  confirmButtonText: "更新",
  fields: [
    {
      prop: "name",
      label: "代理名称",
      placeholder: "请输入代理名称",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 50
    },
    {
      prop: "manager",
      label: "负责人",
      placeholder: "请输入负责人姓名",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 20
    },
    {
      prop: "phone",
      label: "联系电话",
      placeholder: "请输入联系电话",
      type: "input",
      required: true,
      pattern: /^1[3-9]\d{9}$/,
      patternMessage: "请输入正确的手机号码"
    },
    {
      prop: "status",
      label: "状态",
      placeholder: "请选择状态",
      type: "select",
      required: true,
      options: [
        { label: "活跃", value: "active" },
        { label: "停用", value: "inactive" }
      ]
    }
  ],
  successMessage: "二级代理更新成功"
}

// 三级代理编辑配置
export const editThirdAgentDialogConfig: DialogConfig = {
  title: "编辑三级代理",
  description: "修改三级代理的基本信息。",
  confirmButtonText: "更新",
  fields: [
    {
      prop: "name",
      label: "代理名称",
      placeholder: "请输入代理名称",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 50
    },
    {
      prop: "manager",
      label: "负责人",
      placeholder: "请输入负责人姓名",
      type: "input",
      required: true,
      minLength: 2,
      maxLength: 20
    },
    {
      prop: "phone",
      label: "联系电话",
      placeholder: "请输入联系电话",
      type: "input",
      required: true,
      pattern: /^1[3-9]\d{9}$/,
      patternMessage: "请输入正确的手机号码"
    },
    {
      prop: "status",
      label: "状态",
      placeholder: "请选择状态",
      type: "select",
      required: true,
      options: [
        { label: "活跃", value: "active" },
        { label: "停用", value: "inactive" }
      ]
    }
  ],
  successMessage: "三级代理更新成功"
}
